package com.tuling.ribbon;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hzdc
 * @date 2022/4/18 22:21
 */
@Configuration
public class RibbonRandomRuleConfig {

    // 方法名一定要叫iRule
    @Bean
    public IRule iRule() {
        // 配置随机负载均衡策略
        return new RandomRule();
    }

}
